package com.xiaoliang.servlet;

import com.xiaoliang.service.impl.ProductServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author XIAOLIANG
 * @ClassName DeleteProduct.java
 * @Description TODO
 * @createTime 2021年02月26日 10:25:00
 */
//@WebServlet("/product/delete")
public class DeleteProduct extends HttpServlet {
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

		String id = req.getParameter("id");

		ProductServiceImpl productService = new ProductServiceImpl();

		boolean b = productService.deleteProduct(Integer.parseInt(id));

		resp.sendRedirect(req.getContextPath()+"/product/productList");

	}
}
